<?php
/**
 * Created by PhpStorm.
 * User: Frings
 * Date: 2016/9/14
 * Time: 15:52
 */
use yii\helpers\Url;

$web = Url::base();
?>

<div class="form-horizontal" id="modaledit_detail_form">
    <div>
        <div class="form-group" style=" margin-top: 5px">
            <label class="control-label col-lg-2" for="exampleInputPassword2">发卡机构：</label>
            <div class="col-lg-10">
                <input type="text" id="from_institution_name" name="from_institution_name" class="form-control"
                       value="<?= $item != null ? $item['from_institution_name'] : '系统机构' ?>">
            </div>
        </div>
        <div class="form-group" style=" margin-top: 5px">
            <label class="control-label col-lg-2" for="exampleInputPassword2">收卡机构：</label>
            <div class="col-lg-10">
                <input type="text" id="to_institution_name" name="to_institution_name" class="form-control"
                       value="<?= $item != null ? $item['to_institution_name'] : '' ?>">
            </div>
        </div>
        <div class="form-group" style=" margin-top: 5px">
            <input type="hidden" id="id" name="id" class="form-control" value="<?= $item != null ? $item['id'] : '' ?>">
            <label class="control-label col-lg-2" for="exampleInputPassword2">卡片名称：</label>
            <div class="col-lg-10">
                <input type="text" id="name" name="name" class="form-control"
                       value="<?= $item != null ? $item['name'] : '' ?>">
            </div>
        </div>
        <div class="form-group" style=" margin-top: 5px">
            <label class="control-label col-lg-2" for="exampleInputPassword2">卡片描述：</label>
            <div class="col-lg-10">
            <textarea id="description" name="description" class="form-control"
                      rows="3"><?= $item != null ? $item['description'] : '' ?></textarea>
            </div>
        </div>

        <div class="form-group" style=" margin-top: 5px">
            <label class="control-label col-lg-2" for="exampleInputPassword2">单证开始：</label>
            <div class="col-lg-2">
                <input type="number" id="start_index" name="start_index" class="form-control"
                       value="<?= $item != null ? $item['start_index'] : '' ?>"">
            </div>
            <label class="control-label col-lg-2" for="exampleInputPassword2">单证数量：</label>
            <div class="col-lg-2">
                <input type="number" id="quantity" name="quantity" class="form-control"
                       value="<?= $item != null ? $item['end_index'] - $item['start_index'] + 1 : '' ?>">
            </div>

            <label class="control-label col-lg-2" for="exampleInputPassword2">单证结束：</label>
            <div class="col-lg-2">
                <input type="number" id="end_index" name="end_index" class="form-control"
                       value="<?= $item != null ? $item['end_index'] : '' ?>">
            </div>
        </div>

        <div class="form-group" style=" margin-top: 5px">
            <label class="control-label col-lg-2" for="exampleInputPassword2">价值积分：</label>
            <div class="col-lg-10">
                <input type="number" id="integral" name="integral" class="form-control"
                       value="<?= $item != null ? $item['integral'] : '' ?>">
            </div>
        </div>
        <div class="form-group" style=" margin-top: 5px;">
            <div class="col-lg-12">
                <table class="table table-bordered table-hover table-condensed" id="goods_table">
                    <thead class="nowrap">
                    <tr>
                        <th class="col-lg-1">排序(数字大的排前面)</th>
                        <th class="col-lg-2">产品编码</th>
                        <th class="col-lg-6">产品名</th>
                        <th class="col-lg-2">价格</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php
                    if ($goods != null && $goods != '') {
                        for ($i = 0; $i < count($goods); $i++) {
                            if ($goods[$i]['sort'] != null) {
                                ?>
                                <tr>
                                    <td name="sort"><?= $goods[$i]['sort'] ?></td>
                                    <td name="code"><?= $goods[$i]['code'] ?></td>
                                    <td name="name"><?= $goods[$i]['name'] ?></td>
                                    <td name="selling_price"><?= $goods[$i]['selling_price'] ?></td>
                                </tr>
                                <?php
                            }
                        }
                    }
                    ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
